//
//  ViewController.m
//  Common
//
//  Created by fangyuan ding on 2021/10/28.
//

#import "ViewController.h"
#import "Son.h"
#import "Sark.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSLog(@"ViewController = %@, 地址 = %p",self,&self);
    id cls = [Sark class];
    NSLog(@"Sark class = %@, 地址 = %p",cls,&cls);
    void *obj = &cls;
    NSLog(@"Void *obj = %@, 地址 = %p",obj,&obj);
    [(__bridge id)obj speak];

    Sark *sark = [[Sark alloc]init];
    NSLog(@"Sark instance = %@ 地址 = %p",sark,&sark);
    [sark speak];
    Son *son = [[Son alloc]init];
    NSLog(@"son=%@",son);
    
    //iskindOfClass & isMemberOfClass 类方法调用
    BOOL re1 = [(id)[NSObject class] isKindOfClass:[NSObject class]];
    BOOL re2 = [(id)[Father class] isKindOfClass:[Father class]];
    BOOL re3 = [(id)[NSObject class] isMemberOfClass:[NSObject class]];
    BOOL re4 = [(id)[Father class] isMemberOfClass:[Father class]];
    NSLog(@" re1 :%hhd\n re2 :%hhd\n re3 :%hhd\n re4 :%hhd\n",re1,re2,re3,re4);
    
    //iskindOfClass & isMemberOfClass 实例方法调用
    BOOL re5 = [(id)[NSObject alloc] isKindOfClass:[NSObject class]];
    BOOL re6 = [(id)[Father alloc] isKindOfClass:[Father class]];
    BOOL re7 = [(id)[NSObject alloc] isMemberOfClass:[NSObject class]];
    BOOL re8 = [(id)[Father alloc] isMemberOfClass:[Father class]];
    NSLog(@" re5 :%hhd\n re6 :%hhd\n re7 :%hhd\n re8 :%hhd\n",re5,re6,re7,re8);
    
}


@end
